error C2440: '=' : cannot convert from 'std::string []' to 'std::string []'

Posted by Bach on Stack Overflow See other posts from Stack Overflow or by Bach
Published on 2010-06-13T06:44:38Z Indexed on 2010/06/13 6:52 UTC
Read the original article Hit count: 331

Filed under:
|

now what is wrong with this code!

Header:

#pragma once
#include <string>
using namespace std;

class Menu
{
public:
    Menu(string []);
    ~Menu(void);

};

Implementation:

#include "Menu.h"

string _choices[];

Menu::Menu(string items[])
{
    _choices = items;
}

Menu::~Menu(void)
{
}

compiler is complaining:

error C2440: '=' : cannot convert from 'std::string []' to 'std::string []'
There are no conversions to array types, although there are conversions to references or pointers to arrays

there is no conversion! so what is it on about?

please help, just need to pass a bloody array of strings and set it to Menu class _choices[] attribute.

thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about beginner